package com.liuyc.lib.common.ext

import android.app.Activity
import androidx.fragment.app.Fragment
import com.tbruyelle.rxpermissions2.RxPermissions

/**
 *
 *
 * 刘隽
 */

/**
 * activity 权限扩展方法
 */
fun Activity.requestPermissionList(vararg permissions: String, block: (aBoolean: Boolean) -> Unit) {
    val subscribe = RxPermissions(this).request(*permissions).subscribe {
        block(it)
    }
}

/**
 *  Fragment 权限扩展方法
 */
fun Fragment.requestPermissionList(vararg permissions: String, block: (aBoolean: Boolean) -> Unit) {

    val subscribe = activity?.let {
        RxPermissions(it).request(*permissions).subscribe {
            block(it)
        }
    }
}

